package cn.iocoder.yudao.module.promotion.dal.mysql.prizedraw;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawNumberPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.prizedraw.PrizeDrawNumberDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户抽奖次数流水 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PrizeDrawNumberMapper extends BaseMapperX<PrizeDrawNumberDO> {

    default PageResult<PrizeDrawNumberDO> selectPage(PrizeDrawNumberPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PrizeDrawNumberDO>()
                .eqIfPresent(PrizeDrawNumberDO::getUserId, reqVO.getUserId())
                .eqIfPresent(PrizeDrawNumberDO::getSettingType, reqVO.getSettingType())
                .eqIfPresent(PrizeDrawNumberDO::getBusinessId, reqVO.getBusinessId())
                .eqIfPresent(PrizeDrawNumberDO::getUseType, reqVO.getUseType())
                .betweenIfPresent(PrizeDrawNumberDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PrizeDrawNumberDO::getPrizeDrawNumberId));
    }

}